/* Copyright 2012 Ilkka Kiistala

This file is part of the Crossmodal-Framework. The Crossmodal-Framework is free software: you can redistribute it and/or modify it under the terms of the GNU 
General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Crossmodal-Framework is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along 
with the Crossmodal Framework.  If not, see <http://www.gnu.org/licenses/> */

package com.example.jsontotactons;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;

import android.content.Context;

public class Experiment {
    // private Long id = null;
    private String name = null;
    private long delay;
    
    // private Tacton[] tactons = null;
	private ArrayList<Tacton> tactons; 


    public Experiment(String name) {
        if (name == null) {
            throw new IllegalArgumentException("Experiment name must not be null");
        }
        this.name = name.trim();
        this.tactons = new ArrayList<Tacton>();
    }

    public Experiment(String name, ArrayList<Tacton> tactonList ) {
        this(name);
        this.tactons = tactonList;
        // this.id = id;
    }

    public Experiment(String name, long delay, ArrayList<Tacton> tactonList ) {
        this(name);
        this.tactons = tactonList;
        this.delay = delay;
        // this.id = id;
    }

    public String getName() {
        return name;
    }
    
    public ArrayList<Tacton> getTactons() {
        return tactons;
    }

	public Tacton getTacton(int i) {
		if (i >= this.tactons.size())
		{
			return null;
		}
		else
		{
			return this.tactons.get(i);
		}
	}

	public boolean hasTactons() {
        return (this.tactons.size() > 0);
	}

	public static String[] tactonNames(TactonList tactonList) {
		// TODO Auto-generated method stub
		return null;
	}

	public int getTactonCount() {
		// TODO Auto-generated method stub
		return this.tactons.size();
	}

	public long getDelay() {
		return this.delay;
	}

	public void addTacton(Tacton tacton) {
		this.tactons.add(tacton);
	}
    

//    public static List<String> findAllTeamNames(Context context) {
//        TeamDAO dao = null;
//        try {
//            dao = daoFactory.getTeamDAO(context);
//            return dao.findAllTeamNames();
//        } finally {
//            if (dao != null) {
//                dao.close();
//            }
//        }
//    }
}
